package com.example.cxz2021606127.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.cxz2021606127.R;
import com.example.cxz2021606127.util.ExitActivityUtil;
import com.example.cxz2021606127.util.MySqLiteHelper;
import com.google.android.material.textfield.TextInputEditText;

import java.util.Timer;
import java.util.TimerTask;

public class GuideActivity extends AppCompatActivity {

    private LinearLayout linearLayout;
    static boolean flag = true;
    Timer timer = new Timer();  //计时器

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);

        //添加该Activity到ExitActivityUtil对象实例容器中
        ExitActivityUtil.getInstance().addActivity(this);


        linearLayout = findViewById(R.id.linearlayout);
        //添加启动页面动画效果
        Animation animation = AnimationUtils.loadAnimation(GuideActivity.this, R.anim.animation);
        linearLayout.startAnimation(animation);

        TimerTask timerTask = new TimerTask() {   //定义计时任务

            @Override
            public void run() {
                Intent intent = new Intent(GuideActivity.this, LoginActivity.class);
                startActivity(intent);
            }

        };
        if (flag) {
            timer.schedule(timerTask, 6000);  //延时6秒
            flag = false;
        } else {
            timer.schedule(timerTask, 0);
        }
    }

}